package com.societyGames.loading  
{
    import com.societyGames.system.EventObject;
	import flash.events.EventDispatcher;
	import com.societyGames.utility.XMLUtility;
	/**
	 * Load an XML from an embedded class.
	 * @author 
	 */
	public class ClassXMLLoadStep extends EventDispatcher implements ILoadStep
	{
		private var _completeEventObject:EventObject;
		private var _xmlClass:Class;
		private var _callback:Function /*function(xml:XML)void*/
		
		public function ClassXMLLoadStep(xmlClass:Class, callback:Function /*function(xml:XML):void*/)
		{
			this._completeEventObject = new EventObject(this, "COMPLETE");
			this._xmlClass = xmlClass;
			this._callback = callback;
		}
		
		//ILoadStep-->
		public function get completeEventObject():EventObject
		{
			return this._completeEventObject;
		}
		
		public function load():void
		{
            this._callback(XMLUtility.loadXMLFromClass(this._xmlClass));
            this._completeEventObject.dispatchEvent();
		}
		//<--ILoadStep
	}
}